local denggao = fk.CreateSkill {
  name = "lingling__denggao",
  tags = { Skill.Compulsory },
}

Fk:loadTranslationTable{
  ["lingling__denggao"] = "登高",
  [":lingling__denggao"] = "锁定技，本回合未使用点数大于7的牌的角色计算与你距离+2。",
}

denggao:addEffect("distance", {
  correct_func = function(self, from, to)
    if to:hasSkill(denggao.name) and from:getMark("lingling__denggao-turn") == 0 then
      return 2
    end
  end,
})

denggao:addEffect(fk.CardUsing, {
  can_refresh = function (self, event, target, player, data)
    return player:hasSkill(denggao.name, true) and not target.dead and
      data.card.number > 7 and target:getMark("lingling__denggao-turn") == 0
  end,
  on_refresh = function (self, event, target, player, data)
    player.room:setPlayerMark(target, "lingling__denggao-turn", 1)
  end,
})

denggao:addAcquireEffect(function (self, player, is_start)
  if not is_start then
    local room = player.room
    room.logic:getEventsOfScope(GameEvent.UseCard, 1, function (e)
      local use = e.data
      if use.card.number > 7 and not use.from.dead then
        room:setPlayerMark(use.from, "lingling__denggao-turn", 1)
      end
    end, Player.HistoryTurn)
  end
end)

return denggao
